<!-- diaWidth  对话框的宽度  单位%-->
<!-- showDialog  对话框是否显示 -->
<!-- diaTop  对话框对屏幕上方的距离  单位vh-->
<!-- titleLeft  对话框头部左侧的margin   单位px-->
<!-- headerName  对话框头部文字 -->
<!-- smallTitle  对话框头部小文字 -->
<!-- backLetter  取消-字-->
<!-- saveLetter  确定-字 -->
<!-- save  确定按钮事件 -->
<!-- footerTop  底部按钮距离上侧距离  单位px-->
<!-- footerBtm  底部按钮距离下侧距离  单位px-->

<template>
  <div class="dialog">
    <el-dialog
      :width="diaWidth + '%'"
      :model-value="showDialog"
      :close-on-click-modal="false"
      :top="diaTop + 'vh'"
      @close="close"
    >
      <template #header>
        <h3 class="dia-header">
          {{ headerName }}
          <!-- <span class="small-title"> {{ smallTitle }}</span> -->
          <img
            @click="back"
            class="img"
            src="@/assets/images/layout/chahao.png"
            alt=""
          />
        </h3>
      </template>
      <slot name="content" />
      <footer
        class="footer"
        v-if="footerShow"
        :style="{ marginTop: footerTop + 'px', marginBottom: footerBtm + 'px' }"
      >
        <div class="save" @click="$emit('save')">
          <button>{{ saveLetter }}</button>
        </div>
        <div class="back" @click="back">
          <button>{{ backLetter }}</button>
        </div>
      </footer>
    </el-dialog>
  </div>
</template>
<script setup lang="ts">
let props = defineProps({
  headerName: {
    type: String,
  },
  showDialog: {},
  titleLeft: {
    type: String,
    default: "43",
  },
  diaWidth: {
    type: String,
    default: "40",
  },
  diaTop: {
    type: String,
    default: "6",
  },
  backLetter: {
    type: String,
    default: "返回",
  },
  saveLetter: {
    type: String,
    default: "确定",
  },
  smallTitle: {
    type: String,
  },
  footerBtm: {
    type: String,
    default: "15",
  },
  footerTop: {
    type: String,
    default: "40",
  },
  footerShow: {
    type: Boolean,
    default: true,
  },
});
// let $emit = defineEmits(["update:showDialog", "save"]);
let $emit = defineEmits(["update:close", "save"]);
let back = () => {
  $emit("close");
};
let close = () => {
  $emit("close");
};
</script>
<style scoped lang="scss">
.dialog {
  :deep(.el-dialog) {
    .el-dialog__header {
      /* background-image: url("../assets/images/product/dia-header-bgc.png"); */
      /* background-repeat: no-repeat;
      background-size: 100% 100%; */
      text-align: center;
      padding: 0;
      width: 100%;
      background-color: #eeeff0;
      height: 73px;
      display: flex;
      justify-content: center;
      align-items: center;
      position: relative;
      /* justify-content: space-between; */
    }
    .el-dialog__body {
      padding-top: 0px;
      background-image: url("../assets/images/product/dia-content-bgc.png");
      background-repeat: no-repeat;
      background-size: 100% 100%;
      background-color: #fff;
    }

    .el-dialog__headerbtn {
      display: none;
    }
    .dia-header {
      font-family: Source Han Sans CN;
      font-weight: bold;
      font-size: 26px;
      color: #333333;

      .small-title {
        margin-left: 30px;
        font-size: 20px;
        font-weight: 400;
        color: #ffffff;
      }
      .img {
        position: absolute;

        cursor: pointer;
        right: 36px;
        top: 50%;
        transform: translateY(-50%);
        width: 22px;
        height: 22px;
      }
    }

    .el-form {
      margin-top: 20px;
    }
    .footer {
      display: flex;
      justify-content: center;
      margin-bottom: 15px;
      .save {
        margin-right: 45px;
        button {
          background: #0874fa;
          border-radius: 28px;

          font-family: Source Han Sans CN;
          font-weight: 500;
          font-size: 24px;
          color: #ffffff;
        }
      }
      .back {
        button {
          font-family: Source Han Sans CN;
          font-weight: 500;
          font-size: 24px;
          color: #666666;

          border: 1px solid #cccccc;
        }
      }
      .back,
      .save {
        width: 159px;
        height: 45px;
        display: flex;
        justify-content: center;
        cursor: pointer;
        button {
          width: 172px;
          height: 56px;

          border-radius: 28px;

          font-family: Source Han Sans CN;
          font-weight: 500;
          font-size: 24px;
        }
      }
      .save {
        margin-left: 49px;
      }
    }
    .el-form-item__label {
      color: #fff;
      font-size: 24px;
      font-weight: 400;
    }
  }
}
</style>
